package org.millioncall.yueyoga.admin.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.millioncall.yueyoga.admin.model.PlacementTestChild;
import org.millioncall.yueyoga.admin.service.TestChildService;
import org.millioncall.yueyoga.common.utils.ZhuwWebAppUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;

@Controller
public class TestChildAction {
	private TestChildService testChildService;

	public TestChildService getTestChildService() {
		return testChildService;
	}

	public void setTestChildService(TestChildService testChildService) {
		this.testChildService = testChildService;
	}

	/** 查询在测试项目下查询具体的测试项目 **/
	@RequestMapping(value = "/childTest.jhtml")
	public void childTest(HttpServletRequest request,
			HttpServletResponse response, Map<String, Object> context) {
		String msg = "";
		String code = request.getParameter("code");// 得到父项目的ID
		int intcode = Integer.parseInt(code);
		List<PlacementTestChild> testChild = testChildService
				.childTest(intcode);// 查询子项目

		msg = "{'success':true,'val':\'" + JSON.toJSONString(testChild) + "\'}";
		ZhuwWebAppUtil.ajaxResponse(response, msg);
	}
}
